//
//  SafeCenterViewController.m
//  gpos_app
//
//  Created by 崔航飞 on 2018/8/15.
//  Copyright © 2018年 apple. All rights reserved.
//

#import "SafeCenterViewController.h"
#import "Masonry.h"
#import "XMWJMmViewController.h"
#import "ChangePassWordViewController.h"
#import "ForgetPassWordViewController.h"
#import "BanDingBankCardViewController.h"
#import "LockController.h"
#import "jymimaViewController.h"
#import "WKProgressHUD.h"
#import "IdentityVerificationViewController.h"
#import "GPosAPI.h"
#import "SVProgressHUD.h"
#import "XMRegisterViewController.h"
@interface SafeCenterViewController ()<UIGestureRecognizerDelegate>
@property (nonatomic,strong) UIView *backgroundViews;
@property (nonatomic,strong) UIView *viewOne;
@property (nonatomic,strong) UIView *viewTwo;
@property (nonatomic,strong) UIView *viewThree;
@property (nonatomic,strong) UIView *viewFour;
@property (nonatomic,strong) UILabel *labFirst;
@property (nonatomic,strong) UILabel *labThred;
@property (nonatomic,strong) UILabel *labFours;
@property (nonatomic,strong) UIView *bigView;
@property (nonatomic,strong) UIView *smailView;
@property (nonatomic,strong) UIButton *tureBtn;
@property (nonatomic,strong) UIButton *cancellBtn;
@property (nonatomic,strong) NSString *ISSHOUSHI;//是否手势密码设置成功
@property (nonatomic,assign) NSInteger statuss;
@property (nonatomic,strong) WKProgressHUD *hud;
@end

@implementation SafeCenterViewController
-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    self.navigationController.navigationBar.hidden=NO;
    //去掉返回的文字
    self.navigationController.navigationBar.topItem.title = @"";
    self.navigationItem.title=@"安全中心";
   
        [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDefault;
    
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(showyesView) name:@"changeYes" object:nil];
    NSString *userName=[[NSUserDefaults standardUserDefaults] objectForKey:@"phoneNumber"];//暂时写死(在LockController.m中一样)
    
    self.ISSHOUSHI = [[NSUserDefaults standardUserDefaults] objectForKey:userName];
//    [[NSUserDefaults standardUserDefaults] removeObjectForKey:userName];
    if ([self.ISSHOUSHI isEqualToString:@"YES"])
    {
        self.labFirst.text = @"已设置";
    }else{
        
        self.labFirst.text = @"未设置";
    }
    self.statuss =  [[[NSUserDefaults standardUserDefaults] objectForKey:@"status"] integerValue];
    if (self.statuss==1)
    {
        self.labThred.text = @"已设置";
    }else{
        
        self.labThred.text = @"未设置";
    }
}
-(void)showyesView{
    
    self.hud=[WKProgressHUD popMessage:@"修改成功" inView:self.view duration:1 animated:YES];
    
}
-(void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
    [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
    
}
-(void)viewDidLayoutSubviews{
    
    [super viewDidLayoutSubviews];
    self.tabBarController.tabBar.hidden = YES;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor=[UIColor whiteColor];
    self.navigationController.navigationBar.backgroundColor=[UIColor whiteColor];
    self.navigationController.navigationBar.tintColor=[UIColor blackColor];
    

    [self initUI];
}
-(void)initUI{
    
    self.backgroundViews=[[UIView alloc] init];
    self.backgroundViews.backgroundColor=[UIColor colorWithWhite:0.94 alpha:1];
    [self.view addSubview:self.backgroundViews];
    [self.backgroundViews mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.view.mas_top).offset(kNavbarHeight);
        make.left.equalTo(self.view.mas_left);
        make.right.equalTo(self.view.mas_right);
        make.height.equalTo(@(KmainScreenHeiht - kNavbarHeight - kBottomSafeHeight));
        
    }];
    self.viewOne = [[UIView alloc] init];
    self.viewOne.backgroundColor = [UIColor whiteColor];
    UITapGestureRecognizer *tapOne=[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapOneClick:)];
    tapOne.delegate = self;
    self.viewOne.tag=1111;
    [self.viewOne addGestureRecognizer:tapOne];
    [self.backgroundViews addSubview:self.viewOne];
    [self.viewOne mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.backgroundViews.mas_top).offset(10);
        make.left.equalTo(self.backgroundViews.mas_left).offset(0);
        make.right.equalTo(self.backgroundViews.mas_right).offset(0);
        make.height.equalTo(@(50));
        
    }];
    
    
    self.viewTwo = [[UIView alloc] init];
    self.viewTwo.backgroundColor = [UIColor whiteColor];
    self.viewTwo.tag=2222;
    UITapGestureRecognizer *tapTwo=[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapTwoClick:)];
    tapTwo.delegate = self;
    [self.viewTwo addGestureRecognizer:tapTwo];
    [self.backgroundViews addSubview:self.viewTwo];
    [self.viewTwo mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.viewOne.mas_bottom).offset(10);
        make.left.equalTo(self.backgroundViews.mas_left).offset(0);
        make.right.equalTo(self.backgroundViews.mas_right).offset(0);
        make.height.equalTo(@(50));
        
    }];
    
    self.viewThree = [[UIView alloc] init];
    self.viewThree.backgroundColor = [UIColor whiteColor];
    UITapGestureRecognizer *tapThree=[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapThreeClick:)];
    tapThree.delegate = self;
    [self.viewThree addGestureRecognizer:tapThree];
    [self.backgroundViews addSubview:self.viewThree];
    [self.viewThree mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.viewTwo.mas_bottom).offset(1);
        make.left.equalTo(self.backgroundViews.mas_left).offset(0);
        make.right.equalTo(self.backgroundViews.mas_right).offset(0);
        make.height.equalTo(@(50));
        
    }];
    
//    //银行卡
    self.viewFour = [[UIView alloc] init];
    self.viewFour.backgroundColor = [UIColor whiteColor];
    UITapGestureRecognizer *tapFour=[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapFourClick:)];
    tapFour.delegate = self;
    [self.viewFour addGestureRecognizer:tapFour];
    [self.backgroundViews addSubview:self.viewFour];
    [self.viewFour mas_makeConstraints:^(MASConstraintMaker *make) {

        make.top.equalTo(self.viewThree.mas_bottom).offset(10);
        make.left.equalTo(self.backgroundViews.mas_left).offset(0);
        make.right.equalTo(self.backgroundViews.mas_right).offset(0);
        make.height.equalTo(@(50));

    }];
    
    UILabel *labOne =[[UILabel alloc] init];
    
    labOne.text = @"手势密码";
    labOne.font = [UIFont systemFontOfSize:16];
    [self.viewOne addSubview:labOne];
    [labOne mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.viewOne.mas_left).offset(15);
        make.top.equalTo(self.viewOne.mas_top).offset(15);
        make.bottom.equalTo(self.viewOne.mas_bottom).offset(-15);
        make.width.equalTo(@(100));
        
    }];
    
    UILabel *labtTwo =[[UILabel alloc] init];
    labtTwo.text = @"登录密码";
    labtTwo.font = [UIFont systemFontOfSize:16];
    [self.viewTwo addSubview:labtTwo];
    [labtTwo mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.viewTwo.mas_left).offset(15);
        make.top.equalTo(self.viewTwo.mas_top).offset(15);
        make.bottom.equalTo(self.viewTwo.mas_bottom).offset(-15);
        make.width.equalTo(@(100));
        
    }];
    
    UILabel *labtThree =[[UILabel alloc] init];
    labtThree.text = @"交易密码";
    labtThree.font = [UIFont systemFontOfSize:16];
    [self.viewThree addSubview:labtThree];
    [labtThree mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.viewThree.mas_left).offset(15);
        make.top.equalTo(self.viewThree.mas_top).offset(15);
        make.bottom.equalTo(self.viewThree.mas_bottom).offset(-15);
        make.width.equalTo(@(100));
        
    }];
    
    //银行卡
    UILabel *labtFour =[[UILabel alloc] init];
    labtFour.text = @"绑定银行卡";
    labtFour.font = [UIFont systemFontOfSize:16];
    [self.viewFour addSubview:labtFour];
    [labtFour mas_makeConstraints:^(MASConstraintMaker *make) {

        make.left.equalTo(self.viewFour.mas_left).offset(15);
        make.top.equalTo(self.viewFour.mas_top).offset(15);
        make.bottom.equalTo(self.viewFour.mas_bottom).offset(-15);
        make.width.equalTo(@(100));

    }];
    
    UIImageView *imageOne = [[UIImageView alloc] init];
    imageOne.image=[UIImage imageNamed:@"icon_jt_you"];
    [self.viewOne addSubview:imageOne];
    [imageOne mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.viewOne.mas_top).offset(20);
        make.right.equalTo(self.viewOne.mas_right).offset(-13);
        
    }];
    
    UIImageView *imageTwo = [[UIImageView alloc] init];
    imageTwo.image=[UIImage imageNamed:@"icon_jt_you"];
    [self.viewTwo addSubview:imageTwo];
    [imageTwo mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.viewTwo.mas_top).offset(20);
        make.right.equalTo(self.viewTwo.mas_right).offset(-13);
        
    }];
    
    UIImageView *imageThree = [[UIImageView alloc] init];
    imageThree.image=[UIImage imageNamed:@"icon_jt_you"];
    [self.viewThree addSubview:imageThree];
    [imageThree mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.viewThree.mas_top).offset(20);
        make.right.equalTo(self.viewThree.mas_right).offset(-13);
        
    }];
    //银行卡
    UIImageView *imageFour = [[UIImageView alloc] init];
    imageFour.image=[UIImage imageNamed:@"icon_jt_you"];
    [self.viewFour addSubview:imageFour];
    [imageFour mas_makeConstraints:^(MASConstraintMaker *make) {

        make.top.equalTo(self.viewFour.mas_top).offset(20);
        make.right.equalTo(self.viewFour.mas_right).offset(-13);

    }];
    
    self.labFirst = [[UILabel alloc] init];
    self.labFirst.textColor = [UIColor grayColor];
    self.labFirst.font = [UIFont systemFontOfSize:15];
    
    self.labFirst.textAlignment = NSTextAlignmentCenter;
    [self.viewOne addSubview:self.labFirst];
    [self.labFirst mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.viewOne.mas_top).offset(15);
        make.right.equalTo(imageOne.mas_left).offset(10);
        make.bottom.equalTo(self.viewOne.mas_bottom).offset(-15);
        make.width.equalTo(@(80));
        
    }];
    
    self.statuss =  [[[NSUserDefaults standardUserDefaults] objectForKey:@"status"] integerValue];
    self.labThred = [[UILabel alloc] init];
    self.labThred.textColor = [UIColor grayColor];
    self.labThred.font = [UIFont systemFontOfSize:15];
    if (self.statuss==1)
    {
        self.labThred.text = @"已设置";
    }else{
        
        self.labThred.text = @"未设置";
    }
    
    self.labThred.textAlignment = NSTextAlignmentCenter;
    [self.viewThree addSubview:self.labThred];
    [self.labThred mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.viewThree.mas_top).offset(15);
        make.right.equalTo(imageThree.mas_left).offset(10);
        make.bottom.equalTo(self.viewThree.mas_bottom).offset(-15);
        make.width.equalTo(@(80));
        
    }];
    /*
    self.labFours = [[UILabel alloc] init];
    self.labFours.textColor = [UIColor grayColor];
    self.labFours.font = [UIFont systemFontOfSize:15];
    self.labFours.text = @"未设置";
    self.labFours.textAlignment = NSTextAlignmentCenter;
    [self.viewFour addSubview:self.labFours];
    [self.labFours mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.viewFour.mas_top).offset(15);
        make.right.equalTo(imageFour.mas_left).offset(10);
        make.bottom.equalTo(self.viewFour.mas_bottom).offset(-15);
        make.width.equalTo(@(80));
        
    }];
    */
}
-(void)tapOneClick:(UIGestureRecognizer *)tp{
    
    [self creatSmallView:self.viewOne.tag];
}
-(void)creatSmallView:(NSInteger)tags{
    
    if (tags==1111)
    {
        //手势密码是否设置成功
        if ([self.ISSHOUSHI isEqualToString:@"YES"]){
            
            //弹出提示框
            self.bigView=[[UIView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)];
            self.bigView.backgroundColor=[[UIColor blackColor]colorWithAlphaComponent:0.3];
            UITapGestureRecognizer *tap=[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(backviewsmallks:)];
            tap.delegate=self;
            [self.bigView addGestureRecognizer:tap];
            
            self.smailView=[[UIView alloc] initWithFrame:CGRectMake(35, [UIScreen mainScreen].bounds.size.height/2-90, [UIScreen mainScreen].bounds.size.width-70, 180)];
            self.smailView.backgroundColor=[UIColor whiteColor];
            self.smailView.layer.cornerRadius=4;
            self.smailView.userInteractionEnabled=YES;
            
            UIView *lineView=[[UIView alloc] initWithFrame:CGRectMake(0, 129, self.smailView.frame.size.width, 1)];
            lineView.backgroundColor=[UIColor grayColor];
            lineView.alpha=0.1;
            [self.smailView addSubview:lineView];
            
            UIView *HlineView=[[UIView alloc] initWithFrame:CGRectMake(self.smailView.frame.size.width/2-0.5, CGRectGetMaxY(lineView.frame), 1, 50)];
            HlineView.backgroundColor=[UIColor grayColor];
            HlineView.alpha=0.1;
            [self.smailView addSubview:HlineView];
            
            UILabel *smalLab=[[UILabel alloc] initWithFrame:CGRectMake(0, 55, self.smailView.frame.size.width, 20)];
            smalLab.text=@"选择您即将要进行的操作";
            smalLab.textAlignment = NSTextAlignmentCenter;
            [self.smailView addSubview:smalLab];
            
            self.cancellBtn=[UIButton buttonWithType:UIButtonTypeCustom];
            self.cancellBtn.frame=CGRectMake(0, CGRectGetMaxY(lineView.frame), self.smailView.frame.size.width/2, 50);
            
            
            [self.cancellBtn setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
            self.cancellBtn.titleLabel.font=[UIFont boldSystemFontOfSize:15];
            
            
            self.tureBtn=[UIButton buttonWithType:UIButtonTypeCustom];
            self.tureBtn.frame=CGRectMake(CGRectGetMaxX(HlineView.frame), CGRectGetMaxY(lineView.frame), self.smailView.frame.size.width/2, 50);
            
            [self.tureBtn setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
            self.tureBtn.titleLabel.font=[UIFont boldSystemFontOfSize:15];
            
            
            [self.cancellBtn setTitle:@"取消手势密码" forState:UIControlStateNormal];
            [self.cancellBtn addTarget:self action:@selector(qxs) forControlEvents:UIControlEventTouchUpInside];
            [self.tureBtn setTitle:@"修改手势密码" forState:UIControlStateNormal];
            [self.tureBtn addTarget:self action:@selector(turesks) forControlEvents:UIControlEventTouchUpInside];
            [self.smailView addSubview:self.cancellBtn];
            [self.smailView addSubview:self.tureBtn];
            [self.bigView addSubview:self.smailView];
            //加到全屏
            [[UIApplication sharedApplication].keyWindow addSubview:self.bigView];
        }else{
            
            LockController *vc=[[LockController alloc] init];
            vc.tagsStyle=2;
            vc.hidesBottomBarWhenPushed=YES;
            [self.navigationController pushViewController:vc animated:YES];
            
        }
        
    }else{
        
        //弹出提示框
        self.bigView=[[UIView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)];
        self.bigView.backgroundColor=[[UIColor blackColor]colorWithAlphaComponent:0.3];
        UITapGestureRecognizer *tap=[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(backviewsmallks:)];
        tap.delegate=self;
        [self.bigView addGestureRecognizer:tap];
        
        self.smailView=[[UIView alloc] initWithFrame:CGRectMake(35, [UIScreen mainScreen].bounds.size.height/2-90, [UIScreen mainScreen].bounds.size.width-70, 180)];
        self.smailView.backgroundColor=[UIColor whiteColor];
        self.smailView.layer.cornerRadius=4;
        self.smailView.userInteractionEnabled=YES;
        
        UIView *lineView=[[UIView alloc] initWithFrame:CGRectMake(0, 129, self.smailView.frame.size.width, 1)];
        lineView.backgroundColor=[UIColor grayColor];
        lineView.alpha=0.1;
        [self.smailView addSubview:lineView];
        
        UIView *HlineView=[[UIView alloc] initWithFrame:CGRectMake(self.smailView.frame.size.width/2-0.5, CGRectGetMaxY(lineView.frame), 1, 50)];
        HlineView.backgroundColor=[UIColor grayColor];
        HlineView.alpha=0.1;
        [self.smailView addSubview:HlineView];
        
        UILabel *smalLab=[[UILabel alloc] initWithFrame:CGRectMake(0, 55, self.smailView.frame.size.width, 20)];
        smalLab.text=@"选择您即将要进行的操作";
        smalLab.textAlignment = NSTextAlignmentCenter;
        [self.smailView addSubview:smalLab];
        
        self.cancellBtn=[UIButton buttonWithType:UIButtonTypeCustom];
        self.cancellBtn.frame=CGRectMake(0, CGRectGetMaxY(lineView.frame), self.smailView.frame.size.width/2, 50);
        
        
        [self.cancellBtn setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
        self.cancellBtn.titleLabel.font=[UIFont boldSystemFontOfSize:15];
        
        
        self.tureBtn=[UIButton buttonWithType:UIButtonTypeCustom];
        self.tureBtn.frame=CGRectMake(CGRectGetMaxX(HlineView.frame), CGRectGetMaxY(lineView.frame), self.smailView.frame.size.width/2, 50);
        
        [self.tureBtn setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
        self.tureBtn.titleLabel.font=[UIFont boldSystemFontOfSize:15];
        [self.cancellBtn setTitle:@"重置登录密码" forState:UIControlStateNormal];
        [self.cancellBtn addTarget:self action:@selector(CZLogin) forControlEvents:UIControlEventTouchUpInside];
        [self.tureBtn setTitle:@"修改登录密码" forState:UIControlStateNormal];
        [self.tureBtn addTarget:self action:@selector(changeLogin) forControlEvents:UIControlEventTouchUpInside];
        [self.smailView addSubview:self.cancellBtn];
        [self.smailView addSubview:self.tureBtn];
        [self.bigView addSubview:self.smailView];
        //加到全屏
        [[UIApplication sharedApplication].keyWindow addSubview:self.bigView];
        
    }
   
    
}

-(void)qxs{
    
    self.bigView.hidden=YES;
   
    LockController *vc=[[LockController alloc] init];
    vc.tagsStyle=0;
    vc.hidesBottomBarWhenPushed=YES;
    [self.navigationController pushViewController:vc animated:YES];
    
    
}
-(void)turesks{
    
    self.bigView.hidden=YES;
  
    LockController *vc=[[LockController alloc] init];
    vc.tagsStyle=1;
    vc.hidesBottomBarWhenPushed=YES;
    [self.navigationController pushViewController:vc animated:YES];
    
    
}
//重置登录密码
-(void)CZLogin{
    
     NSLog(@"重置登录密码");
    
    self.bigView.hidden=YES;
    UIStoryboard * story = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
    
    XMWJMmViewController * WJMmVC = [story instantiateViewControllerWithIdentifier:@"XMWJMmViewController"];
    WJMmVC.hidesBottomBarWhenPushed = YES;
    WJMmVC.phonedh=[NSString stringWithFormat:@"%@", [[NSUserDefaults standardUserDefaults] objectForKey:@"phoneNumber"]];
    [self.navigationController pushViewController:WJMmVC animated:YES];
}
//修改登录密码
-(void)changeLogin{
    
    self.bigView.hidden=YES;
    ChangePassWordViewController *vc=[[ChangePassWordViewController alloc] init];
    vc.hidesBottomBarWhenPushed = YES;
    [self.navigationController pushViewController:vc animated:YES];
    
}
-(void)backviewsmallks:(UITapGestureRecognizer *)tp{
    
    [UIView animateWithDuration:0.6 animations:^{
        
    } completion:^(BOOL finished) {
        
        self.bigView.hidden=YES;
        
    }];
    
}
//手势的代理(点击大的视图，防止触发小的视图)
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
    
    if ([touch.view isDescendantOfView:self.smailView]) {
        return NO;
    }
    return YES;
}
-(void)tapTwoClick:(UIGestureRecognizer *)tp{
    
    [self creatSmallView:self.viewTwo.tag];
    
}

-(void)tapThreeClick:(UIGestureRecognizer *)tp{
    if (self.statuss==1)
    {
        ForgetPassWordViewController *vc=[[ForgetPassWordViewController alloc] init];
        vc.hidesBottomBarWhenPushed = YES;
        [self.navigationController pushViewController:vc animated:YES];
    
    }else{
        
        jymimaViewController *vc=[[jymimaViewController alloc] init];
        vc.hidesBottomBarWhenPushed = YES;
        [self.navigationController pushViewController:vc animated:YES];
    
}
}
-(void)dealloc{
    
    [[NSNotificationCenter defaultCenter] removeObserver:self];
    
}
//银行卡绑定
-(void)tapFourClick:(UIGestureRecognizer *)tp{
    self.viewFour.userInteractionEnabled = NO;
    [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDefault;
    int userId=[[[NSUserDefaults standardUserDefaults] objectForKey:@"userId"] intValue];
    __weak typeof(self) weakSelf = self;
    NSDictionary * params = @{@"userId": @(userId)};
    [GPosAPI requestUserInfosWithParams:params andCallback:^(id obj) {
        NSLog(@"---判断--%@",obj);
        if (obj==nil)
        {
            
            [SVProgressHUD showErrorWithStatus:@"请求失败,请检查您的网络状态"];
            [SVProgressHUD setDefaultStyle:SVProgressHUDStyleDark];
            [SVProgressHUD setDefaultAnimationType:SVProgressHUDAnimationTypeFlat];
            self.viewFour.userInteractionEnabled = YES;
        }else{
            
            if ([[obj objectForKey:@"code"] integerValue] ==200)
            {
                
                NSDictionary * dict = [obj objectForKey:@"data"];
                NSInteger starus = [[dict objectForKey:@"status"] integerValue];
//                NSLog(@"statu---%ld",starus);
                if (starus == 1)
                {
                    
                    IdentityVerificationViewController * VC = [[IdentityVerificationViewController alloc] init];
                    VC.hidesBottomBarWhenPushed = YES;
                    [self.navigationController pushViewController:VC animated:YES];
                    
                }
                else if (starus == 2)
                {
                    self.hud=[WKProgressHUD popMessage:@"身份验证审核中" inView:self.view duration:1 animated:YES];
                }
                else if (starus == 3)
                {
                    BanDingBankCardViewController *vc=[[BanDingBankCardViewController alloc] init];
                    vc.hidesBottomBarWhenPushed = YES;
                    [self.navigationController pushViewController:vc animated:YES];
                }
               self.viewFour.userInteractionEnabled = YES;
            }else if ([[obj objectForKey:@"code"] integerValue]==401 || [[obj objectForKey:@"code"] intValue] == 402){
                
                UIStoryboard *mainStory = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
                [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"passWord"];
                //storyboard里的ID
                XMRegisterViewController *vc = [mainStory instantiateInitialViewController];
                vc.navigationController.navigationBarHidden=NO;
                //                    //设置当前窗口的根控制器
                self.viewFour.userInteractionEnabled = YES;
                [UIApplication sharedApplication].keyWindow.rootViewController=vc;
                [SVProgressHUD showInfoWithStatus:[obj objectForKey:@"message"]];
                [SVProgressHUD setDefaultStyle:SVProgressHUDStyleDark];
                [SVProgressHUD setDefaultAnimationType:SVProgressHUDAnimationTypeFlat];
                
            }
            else{
                
                self.viewFour.userInteractionEnabled = YES;
                [SVProgressHUD showErrorWithStatus:[obj objectForKey:@"message"]];
                [SVProgressHUD setDefaultStyle:SVProgressHUDStyleDark];
                [SVProgressHUD setDefaultAnimationType:SVProgressHUDAnimationTypeFlat];
                
            }
        }
    }];
    
    
}
 
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



@end
